#include<bits/stdc++.h>
using namespace std;
int n, m, ret = n;

signed main() {
	cin >> n;
	ret = n;
	for(int i = 1, j = 1; 2 * i <= n; i = j * 2 + 1,++j, ret--) {}
	cout << ret << endl;
	return 0;
}
